<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    function upandlow(str){
        var str1 = str.split('')
        str1.forEach((item,index)=>{
            if(str1[index]>= 'a' && str1[index]<='z'){
                str1[index]=str1[index].toUpperCase()
            }else if (str1[index]>='A'&& str1[index]<='Z'){
                str1[index]=str1[index].toLowerCase()
            }
        })
       return str1.join('')
    }
    var str = upandlow('HelloWorld')
    console.log(str);
    
</script>
